package lab1;

class RunThread implements Runnable{

	@Override
	public void run() {
		for (int i = 0; i < 10; i++)
		{
			System.out.println(i + " " + Thread.currentThread().getName());
			try {
				Thread.sleep((int)(Math.random() * 1000));
			} 
			catch (InterruptedException e)
			{}
		}
		System.out.println("DONE! " + Thread.currentThread().getName());
	}

}

public class RunableTest {
	public static void main (String[] args) {
		RunThread r = new RunThread();
		Thread one = new Thread(r);
		Thread two = new Thread(r);

		one.setName("Go to Shanghai??");
		two.setName("Stay here!!");
		one.start();
		two.start();
	}
}
